// landing page controller
public class landingPageController {

    
    public Lead l {
    get{
        if(l == null){
            l = [Select id, FirstName, LastName from Lead where Unique_Id__c =:ApexPages.currentPage().getParameters().get('p') limit 1];
        }
        return l;
    }
    set;
    }
    
    public integer appCount {
    get
    {
        return [Select count() from Application__c where Lead__c =:l.id ];
    }
    set;
    }

    public PageReference addApplication(){
        Application__c a = new Application__c(Lead__c = l.id);
        try {
            insert a;
        } catch (Exception ex){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error on creating application:'+ex));
        }
        return null;
    
    }
    
    

}